import random
import time


class RENWU:
    def __init__(self,name,sleep_time,wake_time,speaking):
        self.name = name
        self.sleep_time = sleep_time
        self.wake_time = wake_time
        self.speaking = speaking
        print(name,"开始睡觉")

    def sleep_way(self,other):
        print(self.name,"正在吵醒-》",other.name)
        a = random.randint(1,100)
        if a == 24:
            print(self.name,"试图大声讲话")
            self.speaking += 20
            other.wake_time = other.sleep_time - self.speaking
            print(other.name,"睡眠时间还有：",other.wake_time)
        elif a == 33:
            print(self.name, "叫你打王者")
            b = random.randint(1,10)
            if b == 5:
                self.speaking += 60
            self.speaking += 30
            other.wake_time = other.sleep_time - self.speaking
            print(other.name, "睡眠时间还有：", other.wake_time)
        elif a == 66:
            print(self.name, "喊你起来吃饭")
            self.speaking += 33
            other.wake_time = other.sleep_time - self.speaking
            print(other.name, "睡眠时间还有：", other.wake_time)
        else:
            print(self.name, "试图叫你")
            other.wake_time = other.sleep_time - self.speaking
            print(other.name, "睡眠时间还有：", other.wake_time)
        return other.wake_time

if __name__ == '__main__':
    b = RENWU("方澜航",100,0,10)
    c = RENWU("东升桑",100,0,10)

    while 1:
        print("------------------------------------------")
        time.sleep(1)
        b_wake_tmie = c.sleep_way(b)
        if b_wake_tmie <= 500:
            print(b.name,"醒了T~T")
            break

        print("------------------------------------------")
        time.sleep(1)
        c_wake_tmie = b.sleep_way(c)
        if c_wake_tmie <= 500:
            print(c.name, "醒了T~T")
            break